package nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import butterknife.BindView;
import butterknife.ButterKnife;
import ezy.lite.util.ContextUtil;
import ezy.lite.util.UI;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.adapter.ItemAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.ShowImage;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.main.Home;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.LifeShopActivity;

/**
 * Created by Administrator on 2016/4/26 0026.
 */
public class ImageAdapter extends ItemAdapter<ShowImage, ImageAdapter.HomeViewHolder> {
    private Context context;

    public ImageAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public HomeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new HomeViewHolder(inflate(R.layout.item_image, parent));
    }

    @Override
    public void onBindViewHolder(HomeViewHolder holder, int position) {
        Glide.with(context).load(getItem(position).image).into(holder.image);
    }


    static class HomeViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.image)
        ImageView image;

        public HomeViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }

    }
}
